Previous | Chapter contents | Next | Book PDF
A controller object acts as the intermediary between the application's view objects and its model objects. Typically controller objects have logic in them that is specific to an application. Controllers are often in charge of making sure the views have access to the model objects they need to display and often act as the conduit through which views learn about changes to the model.
By confining application-specific code to controller objects, you make model and view objects more general and reusable. Controllers are often the least reusable objects in an application, but that's acceptable. You can't reuse everything and if you keep the non-reusable code in the controller layer, you have a much better chance of reusing the other objects.
The controller layer frequently contains many lines of code. To make this quantity of code more manageable, it is sometimes useful to subdivide the controller layer further into "model-controllers" and "view-controllers". (This split fits well with the document architecture discussed elsewhere in this document.)
The section "Document Architecture " provides a little more detail on the distinction between model-controller and view-controller.
Previous | Chapter contents | Next | Book PDF